Skip to content

engine, gameui: use system jpeglib headers on Linux - #494

Open
Opvolger wants to merge 1 commit into
nillerusr:masterfrom
Opvolger:feature/fix-libjpeg
Open

Opvolger wants to merge 1 commit into
nillerusr:masterfrom
Opvolger:feature/fix-libjpeg

Conversation

@Opvolger

@Opvolger Opvolger commented Nov 7, 2026

Copy link
Copy Markdown

On Linux, taking a screenshot with the jpeg command (bound to F5 by default) aborts the game:

Wrong JPEG library version: library is 62, caller expects 80

This is the crash in #177, and probably also #455 (F5 pressed instead of quicksave on Debian 12).

Cause

On Linux, wscript links the system libjpeg (check_cfg(package='libjpeg')). On Debian and Fedora that is libjpeg-turbo with API version 62. engine/sys_getmodes.cpp and gameui/OptionsSubMultiplayer.cpp (spray import), however, include the bundled libjpeg v8 header from public/jpeglib. libjpeg checks at runtime that the header version matches the library, and aborts when it does not.

Fix

On Linux, both files now include the system <jpeglib.h>, as common/imageutils.cpp already does. The header and the library then always come from the same package, whatever libjpeg version the distribution ships. Windows and Android keep the bundled header, because they also use the bundled library.

Testing

Fedora 44 x86_64, a jpeg command on d1_canals_01:

Build Result
master abort: Wrong JPEG library version: library is 62, caller expects 80
this PR hl2/screenshots/snapshot0000.jpg is written (valid 1280×720 JPEG)

How this was made

I made this together with Claude Code, Anthropic's AI coding assistant. I guided it throughout and kept the change small, following what common/imageutils.cpp already does. I tested the result myself as described above.

sys_getmodes.cpp and OptionsSubMultiplayer.cpp included the bundled
libjpeg v8 header (public/jpeglib), while on Linux the system
libjpeg(-turbo) is linked (API 62). The `jpeg` console command aborted
with "Wrong JPEG library version: library is 62, caller expects 80".

Include <jpeglib.h> like common/imageutils.cpp already does; Windows and
Android keep the bundled header.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant